<%@ page import="dao.AdminDao" %>
<%@ page import="bean.AdminBean" %>
<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>读者管理</title>
    <link rel="stylesheet" href="css/bm.css">
</head>

<body>
<% //到数据库中查询所有读者
    ArrayList<AdminBean> all = null;
    all = new AdminDao().get_ListInfo();
%>
<header>
    <span class="sp">欢迎使用图书管理系统</span>
    <span class="adm">欢迎你，管理员</span>
</header>
<div class="center">

    <div class="head">
        <h1>读者管理</h1>
        <div class="ah"><a href=login.html>重新登录</a>----||----<a href=index1.html>返回主界面</a></div>
    </div>

    <table>
        <tr>
            <th>用户id</th>
            <th>用户名</th>
            <th>密码</th>
            <th>email</th>
            <th>phone</th>
            <th>用户权限</th>
            <th>最大可借阅数量</th>
            <th>最长可借阅时间</th>
            <th>添加</th>
            <th>更新</th>
            <th>修改</th>
        </tr>
        <%
            //定义一个颜色数组
           /* String[] mycol = {"silver", "pink"};*/
            for (int i = 0; i < all.size(); i++) {
                AdminBean b = (AdminBean) all.get(i);
        %>
        <tr>
            <td><%=b.getUsername() %>
            </td>
            <td><%=b.getName() %>
            </td>
            <td><%=b.getPassword() %>
            </td>
            <td><%=b.getEmail() %>
            </td>
            <td><%=b.getPhone() %>
            </td>
            <td><%=b.getStatus() == 0 ? "学生" : "管理员"%>
            </td>
            <td><%=b.getLend_num() %>
            </td>
            <td><%=b.getMax_num() %>
            </td>
            <td><a href=addReader.html>添加</a></td>
            <td><a href=updateReader.jsp?aid=<%=b.getAid() %>>更新</a></td>
            <td><a href=deleteUserServlet?aid=<%=b.getAid() %>>删除</a></td>
        </tr>

        <%} %>
    </table>
</div>
<div class="buttom">
    <span>欢迎使用图书管理系统</span>
</div>
</body>
</html>
